package com.test.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyBatisPlusConfig {
    //配置MP各种拦截器
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
//1.创建拦截器对象，可以添加MP各种拦截器
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
//2.添加分页的内部拦截器
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
//3.返回拦截器对象
        return interceptor;
    }
}
